/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.ana.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lucas.nunes
 */
@Entity
@Table(name = "QLTTB_TIPO_GRAFICO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoGrafico.findAll", query = "SELECT t FROM TipoGrafico t"),
    @NamedQuery(name = "TipoGrafico.findByTpgId", query = "SELECT t FROM TipoGrafico t WHERE t.tpgId = :tpgId"),
    @NamedQuery(name = "TipoGrafico.findByTpgNm", query = "SELECT t FROM TipoGrafico t WHERE t.tpgNm = :tpgNm"),
    @NamedQuery(name = "TipoGrafico.findByTpgDs", query = "SELECT t FROM TipoGrafico t WHERE t.tpgDs = :tpgDs")})
public class TipoGrafico implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "TPG_ID")
    private BigDecimal tpgId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 104)
    @Column(name = "TPG_NM")
    private String tpgNm;
    @Size(max = 4000)
    @Column(name = "TPG_DS")
    private String tpgDs;
    @OneToMany(mappedBy = "varTpgId")
    private List<Variavel> variavelList;

    public TipoGrafico() {
    }

    public TipoGrafico(BigDecimal tpgId) {
        this.tpgId = tpgId;
    }

    public TipoGrafico(BigDecimal tpgId, String tpgNm) {
        this.tpgId = tpgId;
        this.tpgNm = tpgNm;
    }

    public BigDecimal getTpgId() {
        return tpgId;
    }

    public void setTpgId(BigDecimal tpgId) {
        this.tpgId = tpgId;
    }

    public String getTpgNm() {
        return tpgNm;
    }

    public void setTpgNm(String tpgNm) {
        this.tpgNm = tpgNm;
    }

    public String getTpgDs() {
        return tpgDs;
    }

    public void setTpgDs(String tpgDs) {
        this.tpgDs = tpgDs;
    }

    @XmlTransient
    public List<Variavel> getVariavelList() {
        return variavelList;
    }

    public void setVariavelList(List<Variavel> variavelList) {
        this.variavelList = variavelList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tpgId != null ? tpgId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoGrafico)) {
            return false;
        }
        TipoGrafico other = (TipoGrafico) object;
        if ((this.tpgId == null && other.tpgId != null) || (this.tpgId != null && !this.tpgId.equals(other.tpgId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.gov.ana.service.TipoGrafico[ tpgId=" + tpgId + " ]";
    }
    
}
